import axios from 'axios'

const request = axios.create({
  baseURL: 'http://127.0.0.1:3000', //所有请求地址的前缀部分
  timeout: 80000, //请求超时毫秒数
})

//request拦截器
request.interceptors.request.use(
  (config) => {
    return config
  },
  (error) => {
    return Promise.reject(error)
  },
)

//response拦截器
request.interceptors.response.use(
  (response) => {
    return response
  },
  (error) => {
    return Promise.reject(error)
  },
)

export default request
